const cloud = require('wx-server-sdk');

const db = cloud.database()


exports.main = async (event, context) => {
    let result = await db.collection('edge').where({
        edge_id: event.data.edge_id
    }).get();
    if (result.data.length != 0) {
        return { 'msg': 'fail', 'data': [] }
    }
    await db.collection('edge').add({
        data: event.data
    });
    return { 'msg': 'ok', 'data': [] }
}